/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package tp2ia_partie2.objects;

import java.util.Objects;

/**
 *
 * @author hp
 */
public class Litteral {

    //contenu
    String C;
    //possitif ou négatif
    boolean statut;
    //proprité qui indique si le litteral est activé ou non
    boolean active;

    public Litteral(String C) {
        this.C = C;
        statut = true;
        active = true;
    }

    public Litteral(String C, boolean statut) {
        this.C = C;
        this.statut = statut;
        active = true;
    }

    public boolean estActive() {
        return active;
    }

    public boolean isNegation() {
        return !statut;
    }

    public void activer() {
        this.active = true;
    }

    public void desactiver() {
        this.active = false;
    }

    public String getC() {
        return C;
    }

    public void setC(String C) {
        this.C = C;
    }

    public void setStatutValue(boolean b) {
        this.statut = b;
    }

    public void setStatut(boolean statut) {
        this.statut = statut;
    }

    @Override
    public String toString() {
        return "Litteral{" + (statut ? "" : "¬") + C + '}';
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 43 * hash + Objects.hashCode(this.C);
        hash = 43 * hash + (this.statut ? 1 : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Litteral other = (Litteral) obj;
        if (!Objects.equals(this.C, other.C)) {
            return false;
        }
        if (this.statut != other.statut) {
            return false;
        }
        return true;
    }
}
